const {createProxyMiddleware} = require('http-proxy-middleware');

const host = `http://127.0.0.1:8090`;

module.exports = function (app) {
  app.use(
    createProxyMiddleware('/v1/app/', {
      target: host,
      changeOrigin: true,
      pathRewrite: {"^/v1/app/": "/v1/app/"}
    }),

    createProxyMiddleware('/v1/app/ws', {
      ws: true,
      target: host,
      changeOrigin: true,
      cookieDomainRewrite: host,
      pathRewrite: {"^/v1/app/ws": "/v1/app/ws"}
    })
  )
}
